<!-- 重大问题处理 -->
<template>
  <div class="page fireHazardCancel-container keyIssuesCancel-page" data-page="keyIssuesCancel" style="z-index: 2;">
    <div class="link-page-nav">
        <a href="#" class="link" @click=$root.backToTab()>
            <i class="iconfont icon-zuo"></i>
        </a>
    </div>
    <div class="link-page-top">
        <div class="link-page-title">立即处理</div>
    </div>
    <div class="page-content" style="padding-bottom: 80px;">
       <div class="fireHazardCancel-content">
          <div class="fireHazardCancel-deal-title">处理类型</div>
          <div class="fireHazardCancel-item-option" id="getKeyCancelType">

          </div>
          <div class="fireHazardCancel-deal-title">备注</div>
          <textarea class="fireHazardCancel-item-text cancle-ios-write" id="keyIssuesCancel-mes" placeholder="请输入..."></textarea>    
       </div>
       <div class="fireHazardCancel-btn-conrtent" style="height:143px;">
         <div @click="key_back" class="one">再想想</div>
         <div @click="quitFireHazardCancel">确认通过</div>
       </div>
    </div>
  </div>
</template>
<script>
    return {
        mounted() {
            var self = this;
            var $ = self.$$;
            self.id = self.$route.params.id;
            $("#keyIssuesCancel-mes").val("");
        },
        data: function () {
            return {
              id:null,
              dictKey:"",
              keyIssues_unHandlerCount:null,
              keyIssues_handlerCount:null
            }
        },
        methods: {
          key_back:function(){
              app.methods.backToTab();
          },
          getImportantHandlerData:function(){
              var self = this;
              var $ = self.$$;
              Dao.getImportantQuestionCount({
                userName: userInfor.accountName,
                organizationIds:userInfor.organizationIds
              },function(re){
                self.keyIssues_unHandlerCount = re.unHandlerCount;
                self.keyIssues_handlerCount = re.handlerCount;
              },false);
          },
          getKeyCancelType:function(){
            var self = this;
            var $ = self.$$;
            $("#getKeyCancelType").empty();
            Dao.getDict({
              code:66,
              userName:userInfor.accountName
            },function(data){
              if (data.dictValueObj && data.dictValueObj.length > 0) {
                  for (var i = 0; i < data.dictValueObj.length; i++) {
                      $("#getKeyCancelType").append(`<div class="option-list getKeyCancelType-cancel-type" id="`+data.dictValueObj[i].dictKey+`"><div class="dot"></div><div class="text"> `+data.dictValueObj[i].dictValue+`</div></div>`);
                  }
              }
              $(".getKeyCancelType-cancel-type").click(function(event) {
                  $(".getKeyCancelType-cancel-type").removeClass('active');
                  $(".dot").removeClass('active');
                  $(event.currentTarget).addClass('active');
                  $(event.currentTarget).find(".dot").addClass('active');
                  var dictKey = $(event.currentTarget).attr("id");
                  self.dictKey = dictKey;
              });
            });
          },
          quitFireHazardCancel:function(){
            var self = this;
            var $ = self.$$;
            var text = $("#keyIssuesCancel-mes").val();
            if(!text){
              app.methods.showToastCenter("请输入描述信息");
              return;
            }
            if(!self.dictKey){
              app.methods.showToastCenter("请输入选择处理类型");
              return;
            }
            Dao.importantQuestionUpdateHandleResult({
                userName:userInfor.accountName,
                id:self.id,
                handleType:self.dictKey,
                handlerAccount:userInfor.accountName,
                remarks:text,
                account:userInfor.accountName,
            },function(data){
              let alarming = JSON.parse(localStorage.getItem("significant_problem"))
              alarming.status = '1'
              localStorage.setItem("significant_problem",JSON.stringify(alarming))
              app.methods.showToastCenter("处理成功！");
              self.getImportantHandlerData();
              keyIssuesListData_rdsp[self.id].status=1;
              app.methods.backToTab();
            });
          },
        },
        on:{
          pageAfterIn: function (e, page) {
            var self = this;
            self.getKeyCancelType();
          },
        }
    }
</script>